<?php
/**
 * @link https://www.kancloud.cn/cleverstone/ymb2
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

namespace builder\tree_table\util;

use builder\tree_table\util\tttcustom\Ajax;
use builder\tree_table\util\tttcustom\Modal;
use builder\tree_table\util\tttcustom\Page;
use builder\tree_table\util\tttcustom\Dropdown;
use builder\tree_table\HelperInterface;

/**
 * 自定义工具项助手
 * ```php
 * // 模态框
 * $this->modal()->title('编辑')->icon('fas fa-edit')->route('user/edit')->params(['id'])->width(800)->height(800);
 *
 * // 页面
 * $this->page()->title('编辑')->icon('fas fa-edit')->route('user/edit')->params(['id']);
 *
 * // AJAX
 * $this->ajax()->title('编辑')->icon('fas fa-edit')->route('user/edit')->params(['id'])->method('POST');
 *
 * //下拉菜单
 * $this->dropdown()->title('更多功能')->icon('fas fa-edit')->toolbarDropdown([
 *      $this->toolbarDropdown->modal()->title('编辑1')->route('user/edit1')->params(['id']),
 *      $this->toolbarDropdown->modal()->title('编辑2')->route('user/edit2')->params(['id']),
 * ]);
 * ```
 * @author cleverstone
 * @since ym2.0
 */
class TTToolbarCustomHelper implements HelperInterface
{
    /**
     * @param string $modalTitle 模态框标题
     * @return Modal
     */
    public function modal($modalTitle = '')
    {
        return new Modal($modalTitle);
    }

    /**
     * @return Page
     */
    public function page()
    {
        return new Page();
    }

    /**
     * @return Ajax
     */
    public function ajax()
    {
        return new Ajax();
    }

    /**
     * @return Dropdown
     */
    public function dropdown()
    {
        return new Dropdown();
    }
}